package cn.net.dpi.shp.model.entity;

import cn.net.dpi.shp.handler.PointTypeHandler;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.locationtech.jts.geom.Point;

import java.io.Serializable;

/**
 * @TableName bxf_nod
 */
@TableName(value = "bxf_nod")
@Data
public class BxfNod implements Serializable {
    /**
     *
     */
    @TableId
    private Integer fid;

    /**
     *
     */
    @TableField(typeHandler = PointTypeHandler.class)
    private Point theGeom;

    /**
     *
     */
    private Long id;

    /**
     *
     */
    private String chaids;

    private Long fileId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BxfNod other = (BxfNod) that;
        return (this.getFid() == null ? other.getFid() == null : this.getFid().equals(other.getFid()))
                && (this.getTheGeom() == null ? other.getTheGeom() == null : this.getTheGeom().equals(other.getTheGeom()))
                && (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getChaids() == null ? other.getChaids() == null : this.getChaids().equals(other.getChaids()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getFid() == null) ? 0 : getFid().hashCode());
        result = prime * result + ((getTheGeom() == null) ? 0 : getTheGeom().hashCode());
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getChaids() == null) ? 0 : getChaids().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", fid=").append(fid);
        sb.append(", theGeom=").append(theGeom);
        sb.append(", id=").append(id);
        sb.append(", chaids=").append(chaids);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}